<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>排重</title>
</head>
<body>
    <script>

        function paiChong(array){
            for(var i = array.length - 1;i>=0;i--){
                for(var j =i-1;j>=0;j--){
                    if(array[i] == array[j]){
                        //删除重复的元素
                        array.splice(j,1);
                        i--;
                        // break;
                    }

                }
            }
            return array;//外层的大循环 排重完毕之后  输出array

        }
        var arr=[1,2,5,6,1,2,1,3,2,3,1,2]
               //0 1 2 3 4 5 6 7 8 9 10 11 索引号
        console.log(paiChong(arr));


    </script>
</body>
</html>